Curl: Check all responses for protected cookies #13326
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
brew style
with your changes locally?brew typecheck
with your changes locally?brew tests
with your changes locally?The response from a URL protected by Cloudflare may only provide a relevant cookie on the first response but
#curl_http_content_headers_and_checksum
only returns the headers of the final response. In this scenario,#curl_check_http_content
isn't able to properly detect the protected URL and this is surfaced as an error instead of skipping the URL (see Homebrew/homebrew-cask#124277).This PR resolves the issue by including the array of response hashes in the return value from
#curl_http_content_headers_and_checksum
, so we can check all the responses in#curl_check_http_content
.Besides that, this also renames the
:status
key in the return hash from#curl_http_content_headers_and_checksum
to:status_code
. This aligns the key name with the return hash from#parse_curl_response
and technically allows us to pass either hash to the#url_protected_by_*
methods (as they both contain:status_code
and:headers
in the expected format. This felt like a nicer way of approaching the switch from thedetails
hash to aresponse
hash.